package com.gaussic.model;

import javax.persistence.*;
import java.sql.Timestamp;

@Entity
@Table(name = "proposal_check", schema = "my_database", catalog = "")
public class ProposalCheckEntity {
    private int id;
    private Integer proposalId;
    private Integer readerId;
    private Timestamp readerAt;
    private String comment;
    private Byte opt;

    @Id
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "proposal_id", nullable = true)
    public Integer getProposalId() {
        return proposalId;
    }

    public void setProposalId(Integer proposalId) {
        this.proposalId = proposalId;
    }

    @Basic
    @Column(name = "reader_id", nullable = true)
    public Integer getReaderId() {
        return readerId;
    }

    public void setReaderId(Integer readerId) {
        this.readerId = readerId;
    }

    @Basic
    @Column(name = "reader_at", nullable = false)
    public Timestamp getReaderAt() {
        return readerAt;
    }

    public void setReaderAt(Timestamp readerAt) {
        this.readerAt = readerAt;
    }

    @Basic
    @Column(name = "comment", nullable = true, length = 500)
    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    @Basic
    @Column(name = "opt", nullable = true)
    public Byte getOpt() {
        return opt;
    }

    public void setOpt(Byte opt) {
        this.opt = opt;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ProposalCheckEntity that = (ProposalCheckEntity) o;

        if (id != that.id) return false;
        if (proposalId != null ? !proposalId.equals(that.proposalId) : that.proposalId != null) return false;
        if (readerId != null ? !readerId.equals(that.readerId) : that.readerId != null) return false;
        if (readerAt != null ? !readerAt.equals(that.readerAt) : that.readerAt != null) return false;
        if (comment != null ? !comment.equals(that.comment) : that.comment != null) return false;
        if (opt != null ? !opt.equals(that.opt) : that.opt != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (proposalId != null ? proposalId.hashCode() : 0);
        result = 31 * result + (readerId != null ? readerId.hashCode() : 0);
        result = 31 * result + (readerAt != null ? readerAt.hashCode() : 0);
        result = 31 * result + (comment != null ? comment.hashCode() : 0);
        result = 31 * result + (opt != null ? opt.hashCode() : 0);
        return result;
    }
}
